package com.example.mymvp.view.adapter;

import android.content.Context;
import android.view.ViewGroup;

import java.util.List;

/**
 * @Name：day07_demo
 * @Description：描述信息
 * @Author：86188 范嘉豪
 * @Date：2021/3/18 16:10
 * 修改人：86188 范嘉豪
 * 修改时间：2021/3/18 16:10
 * 修改备注：
 */
public abstract class MulitipleAdpter<DATA> extends BaseAdapter<DATA>{
    private CommType<DATA> commType;
    protected int type=-1;
    public MulitipleAdpter(List<DATA> datas, Context context,CommType commType) {
        super(datas, context, 0);
        this.commType=commType;
    }

    @Override
    public int getItemViewType(int position) {
        type=commType.getType(position,datas.get(position));
         return type;
    }

    @Override
    public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        int typeLayout = commType.getTypeLayout(viewType);
        return new BaseViewHolder(layoutInflater.inflate(typeLayout,parent,false));
    }
}
